/**
 * Created by claim on 17-3-26.
 */
const agent = require('superagent');
const bluebird = require('bluebird');

bluebird.promisifyAll(agent);
//动态地为对象添加了方法

let a = "toString";
console.log(agent[a]());

async function getUrl(url) {
    let page = await agent.get(url).endAsync();
    console.log(page.text);
}

// getUrl('www.baidu.com').catch(e=>{
//     console.log(e);
// });